home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / libcruft / lapack / dzsum1.f < prev    next >
Text File  |  1996-07-19  |  2KB  |  83 lines

  1.       DOUBLE PRECISION FUNCTION DZSUM1( N, CX, INCX )
  2. *
  3. *  -- LAPACK auxiliary routine (version 2.0) --
  4. *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5. *     Courant Institute, Argonne National Lab, and Rice University
  6. *     October 31, 1992
  7. *
  8. *     .. Scalar Arguments ..
  9.       INTEGER            INCX, N
  10. *     ..
  11. *     .. Array Arguments ..
  12.       COMPLEX*16         CX( * )
  13. *     ..
  14. *
  15. *  Purpose
  16. *  =======
  17. *
  18. *  DZSUM1 takes the sum of the absolute values of a complex
  19. *  vector and returns a double precision result.
  20. *
  21. *  Based on DZASUM from the Level 1 BLAS.
  22. *  The change is to use the 'genuine' absolute value.
  23. *
  24. *  Contributed by Nick Higham for use with ZLACON.
  25. *
  26. *  Arguments
  27. *  =========
  28. *
  29. *  N       (input) INTEGER
  30. *          The number of elements in the vector CX.
  31. *
  32. *  CX      (input) COMPLEX*16 array, dimension (N)
  33. *          The vector whose elements will be summed.
  34. *
  35. *  INCX    (input) INTEGER
  36. *          The spacing between successive values of CX.  INCX > 0.
  37. *
  38. *  =====================================================================
  39. *
  40. *     .. Local Scalars ..
  41.       INTEGER            I, NINCX
  42.       DOUBLE PRECISION   STEMP
  43. *     ..
  44. *     .. Intrinsic Functions ..
  45.       INTRINSIC          ABS
  46. *     ..
  47. *     .. Executable Statements ..
  48. *
  49.       DZSUM1 = 0.0D0
  50.       STEMP = 0.0D0
  51.       IF( N.LE.0 )
  52.      $   RETURN
  53.       IF( INCX.EQ.1 )
  54.      $   GO TO 20
  55. *
  56. *     CODE FOR INCREMENT NOT EQUAL TO 1
  57. *
  58.       NINCX = N*INCX
  59.       DO 10 I = 1, NINCX, INCX
  60. *
  61. *        NEXT LINE MODIFIED.
  62. *
  63.          STEMP = STEMP + ABS( CX( I ) )
  64.    10 CONTINUE
  65.       DZSUM1 = STEMP
  66.       RETURN
  67. *
  68. *     CODE FOR INCREMENT EQUAL TO 1
  69. *
  70.    20 CONTINUE
  71.       DO 30 I = 1, N
  72. *
  73. *        NEXT LINE MODIFIED.
  74. *
  75.          STEMP = STEMP + ABS( CX( I ) )
  76.    30 CONTINUE
  77.       DZSUM1 = STEMP
  78.       RETURN
  79. *
  80. *     End of DZSUM1
  81. *
  82.       END
  83.